package test1;

import java.util.Arrays;

public class Test5 {
    public static void main(String[] args) {
        int[] nums = new int[]{1, 5, 2, 5, 2, 5, 3, 4, 8, 9};
        int[] arr = select_sort(nums);
        for (int i : arr) {
            System.out.print(i + " ");
        }
    }

    private static int[] select_sort(int[] nums) {
        int[] arr = Arrays.copyOf(nums, nums.length);


        for (int i = 0; i < arr.length - 1; i++) {
            int min = i;
            for (int j = i + 1; j < arr.length; j++) {
                if (arr[min] < arr[j]) {
                    min = j;
                }
            }
            if (min != i) {
                int tmp = arr[min];
                arr[min] = arr[i];
                arr[i] = tmp;
            }
        }
        return arr;
    }
}
